package practice.thread.talk.server;

import java.util.List;

class BroadCast extends Thread {

	public BroadCast() {
	}

	public void run() {
		while (true) {

			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				;
			}
			String m = AppContext.getInstance().popMessage();
			if (m == null) {
				continue;
			}
			List<ClientThread> clients = AppContext.getInstance()
					.getCloneClients();
			for (ClientThread cThread : clients) {
				cThread.out.println(m + "\0");
				cThread.out.flush();
			}
		}
	}
}
